a5158a22236a2f3dea58480ef2122d0b4e00566d,framework/src/main/java/org/apache/felix/framework/util/ManifestParser.java,ManifestParser,ManifestParser,#Logger#PropertyResolver#Map#,43
Before Change
// Create non-duplicated import array.
dupeMap.clear();
for (int pkgIdx = 0; pkgIdx < pkgs.length; pkgIdx++)
{
// Verify that the named package has not already been declared.
if (dupeMap.get(pkgs[pkgIdx].getName()) == null)
{
// Verify that java.* packages are not imported.
if (pkgs[pkgIdx].getName().startsWith("java."))
{
throw new BundleException(
"Importing java.* packages not allowed: " + pkgs[pkgIdx].getName());
}
dupeMap.put(pkgs[pkgIdx].getName(), new R4Import(pkgs[pkgIdx]));
}
else
{
throw new BundleException(
"Duplicate import - " + pkgs[pkgIdx].getName());
}
}
m_imports = (R4Import[]) dupeMap.values().toArray(new R4Import[dupeMap.size()]);
//
// Parse DynamicImport-Package.
//
// Get dynamic import packages from bundle manifest.
pkgs = parseImportExportHeader(
(String) headerMap.get(Constants.DYNAMICIMPORT_PACKAGE));
// Dynamic imports can have duplicates, so just create an array.
List dynList = new ArrayList();
for (int pkgIdx = 0; pkgIdx < pkgs.length; pkgIdx++)
{
// Verify that java.* packages are not imported.
if (pkgs[pkgIdx].getName().startsWith("java."))
{
throw new BundleException(
"Dynamically importing java.* packages not allowed: "
+ pkgs[pkgIdx].getName());
}
dynList.add(new R4Import(pkgs[pkgIdx]));
}
m_dynamics = (R4Import[]) dynList.toArray(new R4Import[dynList.size()]);
After Change
// Create non-duplicated export array.
dupeMap.clear();
for (int pkgIdx = 0; pkgIdx < m_exports.length; pkgIdx++)
{
// Verify that the named package has not already been declared.
if (dupeMap.get(m_exports[pkgIdx].getName()) == null)
{
// Verify that java.* packages are not exported.
if (m_exports[pkgIdx].getName().startsWith("java."))
{
throw new BundleException(
"Exporting java.* packages not allowed: "
+ m_exports[pkgIdx].getName());
}
dupeMap.put(m_exports[pkgIdx].getName(), m_exports[pkgIdx]);
}
else
{
// TODO: FRAMEWORK - Exports can be duplicated, so fix this.
m_logger.log(Logger.LOG_WARNING, "Duplicate export - "
+ m_exports[pkgIdx].getName());
}
}
// This following line won't be necessary once duplicate exports are supported.
m_exports = (R4Export[]) dupeMap.values().toArray(new R4Export[dupeMap.size()]);
//
// Parse Require-Bundle
//
clauses = parseStandardHeader(
(String) headerMap.get(Constants.REQUIRE_BUNDLE));
if (clauses.length > 0)
{
for (int clauseIdx = 0; clauseIdx < clauses.length; clauseIdx++)
{
for (int pathIdx = 0; pathIdx < clauses[clauseIdx][CLAUSE_PATHS_INDEX].length; pathIdx++)
{
// try
// {
// reqList.add(
// new Requirement(
// ICapability.MODULE_NAMESPACE,
// "(symbolicname=" + clauses[clauseIdx][HEADER_PATHS_INDEX][pathIdx] + ")"));
// }
// catch (InvalidSyntaxException ex)
// {
// Should never happen.
// }
}
}
}
//
// Parse Import-Package.
//
// Get import packages from bundle manifest.
m_imports = (R4Import[]) parseImportExportHeader(
(String) headerMap.get(Constants.IMPORT_PACKAGE), false);
// Create non-duplicated import array.
dupeMap.clear();
for (int pkgIdx = 0; pkgIdx < m_imports.length; pkgIdx++)
{
// Verify that the named package has not already been declared.
if (dupeMap.get(m_imports[pkgIdx].getName()) == null)
{
// Verify that java.* packages are not imported.
if (m_imports[pkgIdx].getName().startsWith("java."))
{
throw new BundleException(
"Importing java.* packages not allowed: "
+ m_imports[pkgIdx].getName());
}
dupeMap.put(m_imports[pkgIdx].getName(), m_imports[pkgIdx]);
}
else
{
throw new BundleException(
"Duplicate import - " + m_imports[pkgIdx].getName());
}
}
//
// Parse DynamicImport-Package.
//
// Get dynamic import packages from bundle manifest.
m_dynamics = (R4Import[]) parseImportExportHeader(
(String) headerMap.get(Constants.DYNAMICIMPORT_PACKAGE), false);
// Dynamic imports can have duplicates, so just check for import
// of java.*.
List dynList = new ArrayList();
for (int pkgIdx = 0; pkgIdx < m_dynamics.length; pkgIdx++)
{
// Verify that java.* packages are not imported.
if (m_dynamics[pkgIdx].getName().startsWith("java."))